package com.wwg.spring.bean.factory;

import java.util.ArrayList;

public class TestMyBeanFactory {

    public static void main(String[] args) {
//        1、注册bean  相当于 spring_config.xml
        BeanDefined beanDefinedStudentManageAccount = new BeanDefined();
        beanDefinedStudentManageAccount.setDefinedId("manageAccount");
        beanDefinedStudentManageAccount.setClassPath("com.wwg.vo.ManageAccount");

        // bean声明列表
        ArrayList<BeanDefined> beanDefinedList = new ArrayList<>();
        beanDefinedList.add(beanDefinedStudentManageAccount);

        // 生成bean工厂  工厂应该也是单例的  不该有多个
        MyBeanFactory myBeanFactory = MyBeanFactory.getMyBeanFactory();
        myBeanFactory.setBenDefinedList(beanDefinedList);

        Object obj = myBeanFactory.getBean(beanDefinedStudentManageAccount);
        System.out.println(obj);

        beanDefinedStudentManageAccount.setDefinedId("student");
        System.out.println(myBeanFactory.getBean(beanDefinedStudentManageAccount));
    }
}
